package com.shuyun.springboot.showcase;

import com.shuyun.springboot.showcase.config.BookConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by feng.ding on 2017/1/5.
 */
@RestController
@SpringBootApplication
public class MainApplication {

    @Value("${book.name}")
    private String bookName;
    @Value("${book.author}")
    private String bookAuthor;

    @Autowired
    private BookConfig bookConfig;

    @RequestMapping("/")
    public String index(){
        return "book name is " + bookName + " book author is " + bookAuthor + "<br/>" +
                "book name is :" + bookConfig.getName() + " book author is : " + bookConfig.getAuthor();
    }

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(MainApplication.class);
//        app.setBannerMode(Banner.Mode.OFF);
        app.run(args);
    }
}
